Double "!!" in Ruby [closed]
Posted
by
Alex Maslakov
on Stack Overflow
See other posts from Stack Overflow
or by Alex Maslakov
Published on 2012-09-08T06:18:48Z
Indexed on
2012/09/08
15:38 UTC
Read the original article
Hit count: 128
ruby
Possible Duplicate:
What does !! mean in ruby?
Ruby, !! operator (a/k/a the double-bang)
Sometimes I see a Ruby code like this
def sent?
!!@sent_at
end
It seems to be not logical. Is it necessary to use here double !
? As far as I'm concerned, it might be just
def sent?
@sent_at
end
UPDATE: then what is the difference between these
def sent?
!!@sent_at
end
def sent?
@sent_at.nil?
end
def sent?
@sent_at == nil
end
© Stack Overflow or respective owner